SOCKETPAIR

Section: System Calls (2)
Index Return to Main Contents

BSD mandoc
BSD 4.2  

NAME

socketpair - create a pair of connected sockets  

SYNOPSIS

Fd #include <sys/types.h> Fd #include <sys/socket.h> Ft int Fn socketpair int d int type int protocol int *sv  

DESCRIPTION

The Fn socketpair call creates an unnamed pair of connected sockets in the specified domain Fa d , of the specified Fa type , and using the optionally specified Fa protocol . The descriptors used in referencing the new sockets are returned in Fa sv Ns [0] and Fa sv Ns [1] . The two sockets are indistinguishable.  

DIAGNOSTICS

A 0 is returned if the call succeeds, -1 if it fails.  

ERRORS

The call succeeds unless:

Bq Er EMFILE
Too many descriptors are in use by this process.
Bq Er EAFNOSUPPORT
The specified address family is not supported on this machine.
Bq Er EPROTONOSUPPORT
The specified protocol is not supported on this machine.
Bq Er EOPNOSUPPORT
The specified protocol does not support creation of socket pairs.
Bq Er EFAULT
The address Fa sv does not specify a valid part of the process address space.
 

SEE ALSO

read(2), write(2), pipe(2)  

BUGS

This call is currently implemented only for the UNIX domain.  

HISTORY

The Fn socketpair function call appeared in BSD 4.2


 

Index

NAME
SYNOPSIS
DESCRIPTION
DIAGNOSTICS
ERRORS
SEE ALSO
BUGS
HISTORY

This document was created by man2html, using the manual pages.
Time: 16:28:59 GMT, April 18, 2022